package org.millioncall.yueyoga.admin.model.base;

import org.millioncall.yueyoga.admin.model.Account;
import org.millioncall.yueyoga.admin.model.UserDetail;

//created by zangjy on 2012-4-5
public abstract class BaseAccount implements java.io.Serializable {
	private static final long serialVersionUID = 566645489153978928L;
	private String id;
	private String alipayAccount;// 绑定的支付宝账户
	private double golds = 0;// 金币数，总金额
	private double validGolds = 0;// 可提现金额
	private double extraGolds = 0;// 附加金额
	private boolean enabled = true;

	private int hashCode = Integer.MIN_VALUE;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
		this.hashCode = Integer.MIN_VALUE;
	}

	public String getAlipayAccount() {
		return alipayAccount;
	}

	public void setAlipayAccount(String alipayAccount) {
		this.alipayAccount = alipayAccount;
	}

	public double getGolds() {
		return golds;
	}

	public void setGolds(double golds) {
		this.golds = golds;
	}

	public double getValidGolds() {
		return validGolds;
	}

	public void setValidGolds(double validGolds) {
		this.validGolds = validGolds;
	}

	public boolean isEnabled() {
		return enabled;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}

	public double getExtraGolds() {
		return extraGolds;
	}

	public void setExtraGolds(double extraGolds) {
		this.extraGolds = extraGolds;
	}

	public boolean equals(Object obj) {
		if(obj == null) {
			return false;
		}
		if(!(obj instanceof UserDetail)) {
			return false;
		} else {
			Account account = (Account)obj;
			if(this.getId() == null || account.getId() == null) {
				return false;
			} else {
				return (this.getId().equals(account.getId()));
			}
		}
	}

	public int hashCode() {
		if(this.hashCode == Integer.MIN_VALUE) {
			if(this.getId() == null) {
				return super.hashCode();
			} else {
				String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();
				this.hashCode = hashStr.hashCode();
			}
		}
		return this.hashCode;
	}
}
